﻿using UnityEngine;
using System.Collections;
using Holoville.HOTween;
using System.Collections.Generic;

public class UIEffect_Button : MonoBehaviour
{
    public float effTime_In = 0.1f;
    public float effTime_Out = 0.16f;
    public float scaleValue = 0.88f; 
    void Awake()
    { 
        this.enabled = false;
    }


    void OnPress(bool isPressed)
    {
        if (isPressed)
        {
            startEffect();  
        }
        else
        {
            endEffect();
        }
    }
    //效果开始
    private void startEffect()
    {
        HOTween.Kill(this.gameObject.transform);
        Atween.scale.to(this.gameObject, effTime_In, scaleValue, scaleValue, EaseType.EaseOutQuad, 0);
    }

    private void endEffect()
    {
        HOTween.Kill(this.gameObject.transform);
        Atween.scale.to(this.gameObject, effTime_Out, 1f, 1f, EaseType.EaseInQuad, 0);
    }
    //void OnSelect(bool isSelected)
    //{
    //}
    void OnDestroy()
    {
        HOTween.Kill(this.gameObject.transform);
    }

}
